<!-- 获取参数 -->
<template>
    <div></div>
</template>

<script>
import { ref, reactive, getCurrentInstance } from 'vue'
import storage from 'store';
import { ACCESS_TOKEN , BRANDID , ACCESS_TOKEN_BRAND } from '@/utils/types';
export default {
    setup() {
        const { proxy } = getCurrentInstance();
        const getParams = () => {
            const params = proxy.getHashParam('sign');
            console.log(params,'params')
            proxy.$http.brandApi.getRequestParams(params)
            .then(res=>{
                console.log(res,'res')
                if(res.success){
                    var DNS = res.data.split(',')[4] ? res.data.split(',')[4] : 'https://szk.lexiangaysh.cn'
                    // window.location.href = `${DNS}/`
                    if(process.env.VUE_APP_API_BASE_URL == '/spellMallProApi'){
                        window.location.href = `${DNS}/szkLinkPro/getcode.html?sign=${encodeURIComponent(res.data)}`
                    }else{
                        window.location.href = `${DNS}/szkLink/getcode.html?sign=${encodeURIComponent(res.data)}`;
                    }
                }else{
                    proxy.$toast({position: 'bottom',message:res.errMessage})
                }
            })
        }
        // 获取配置的系统token
        // 获取系统的token
        // function getToken(brandId,isBrand){
        //     return new Promise((resolve,reject)=>{
        //         proxy.$http.brandApi.getToken(brandId)
        //         .then(res=>{
        //             if(res.success){
        //                 if(isBrand == '1'){
        //                     storage.set(ACCESS_TOKEN,res[ACCESS_TOKEN], res.expires_in)
                            
        //                 }else{
        //                     storage.set(ACCESS_TOKEN_BRAND,res[ACCESS_TOKEN], res.expires_in)
        //                 }
        //                 console.log('111222333')
        //                 resolve()
        //             }
        //         })
        //     })
        // }
        // const allPromis = async() =>{
        //     await getToken(1,0)
        //     getParams()
        // }
        // allPromis();
        getParams()
    }
}

</script>
<style scoped>

</style>